package com.example.houseman.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 证件类型
 *
 * @author lzj
 */
public enum CertificateType {
    IDCARD("身份证", 0),
    passport("护照", 1),
    MILITARYLICENSE("军官证", 2),
    DRIVE("驾驶证", 3),
    ACCOUNTBOOK("户口本", 4),
    MTPS("台胞证", 5),
    HKMACAOPASS("港澳通行证", 6),
    RESIDENCEPERMIT("居住证", 7),
    OTHER("其他", 8);

    @JsonValue
    private String name;
    @EnumValue
    private int index;

    private CertificateType(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getName(int index) {
        for (CertificateType c : CertificateType.values()) {
            if (c.getIndex() == index) {
                return c.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }


}
